import org.apache.commons.codec.binary.Hex;
import p12.P12Util;
import tls.RSAUtil;

import java.nio.charset.StandardCharsets;
import java.security.Signature;

public class TEST2 {
    public static void main(String[] args) throws Exception {
        String data ="04cec7e74ba698d918ac986cce45d2b8cb124cf7e5e04c8e70546883cccd3849b625e227b5b63c8dabd935e51ba964caa10947aa7b50b20d2e47d07a271cd36fcd";
        String server_Signnature="6cbf6904c0ccd88ca4f9453f06021ef2a937da6f5d63e67de2bad5fedb5ffca8343398f511cbbecdc20f4ec49bc0799aeb12298c37af9ceb183ca20822a0567b1b4dab633595e9e9fb9970683b06a565e4ba9b58b871df3f16b41665bf24fe4d02b36865bee0ecb212233fa617d78604e3220f757157a1591ea39820f40070c895e32068ab9b5c3f32e75389fb25c3242d10a1e9ce4b3851d431a1832abf8d3532dc29ba8737ffc62321aa058195142c05ee17b0f28acc4f9a1b5c6bec9b3cff1da8908585fbe4b29f7551e8e8bb27e8697ad20c5d460ddd8e7c37b2ef6f527b3a4d9ef3a8375c76f14baffe22ca5ff3eca67a16761c2ba3572d060a230c42bb";
        byte[] signed_bytes = Hex.decodeHex(server_Signnature);

//        Signature sign1=Signature.getInstance("SHA256withRSA");
//        sign1.initSign(P12Util.getPrivateKey());
//        sign1.update("黄飞".getBytes(StandardCharsets.UTF_8));
//        byte[] signed_bytes = sign1.sign();
//        /**
//         * 582c20abec6f4c3edae2731e03be8b38aa6c86b47ad91bb7b9ead74d321bd0c7ea1107260fdb0ad663e7b42886613dfe728a87482a1ac08ce7df2640a486dd29895e22870e525482629ac51edc9a1eaf18bcdb48144da36ce1f32aa3d2dd1f26e9d699b355b11a858f0157a86afd6686ab9cc56342a3484fa6e8c1ecbb9a632e727330e9087dbd5cbbe697c4bd61780ecf8334543130db3a7d881718e8b638834d81e3c503a10168e46f05f86b84421f1e9e0f0d6db775aa4cf819adcb80b9843e0f5b4659d68b3a5d881fbcec1f5f09dc71d3c1cfaf34a71ee95688598114744fc79b91953e5f84e88d6cf83b5a6ba78fd6beead7e2927c3c54cb61649b0a72
//         */
//        System.err.println(Hex.encodeHexString(signed_bytes));

        Signature sign2=Signature.getInstance("RSASSA-PSS");
        sign2.initVerify(P12Util.getPublicKey());
        sign2.update(Hex.decodeHex(data));
        boolean verify = sign2.verify(signed_bytes);
        System.err.println(verify);


    }
}
